package com.toy.controller;

import com.toy.query.goods.GoodsQuery;
import com.toy.utils.EasyUIResult;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/toy")
public class GoodsController extends  BaseController{

    private static final Log log = LogFactory.getLog(GoodsController.class);


    @RequestMapping("/page/goods_create")
    public String getGoodsCreatePage(){
        return  "goodsCreate";
    }
    @RequestMapping("/page/goods_list")
    public String getPage() {
        return  "goodsList";
    }

    /**
     * 商品列表
     * @param goodsQuery
     * @return
     */
    @RequestMapping("/goods_list")
    @ResponseBody
    public EasyUIResult listGoods(GoodsQuery goodsQuery) {
        EasyUIResult easyUIResult = null;
        try {
            easyUIResult = goodsService.queryGoods(goodsQuery);
        } catch (Exception e) {
            log.error(e.getMessage(),e);
        }
        return  easyUIResult;
    }
}
